// .txt

beginzonescript;

variables;

short im_hostile = 0;
short last_abil;
short counter = 0;
short set_ter1 = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_name(2000,"Lyazza");
	set_name(30001,"Kranas Settler");
	set_name(30002,"Kranas Settler");

	set_name(30003,"Gassy Blob");
	alter_stat(30003,89,3);
	change_max_health(30003,20);
	place_particle_num(30003,1039,12,4);
	place_particle_num(30003,1039,13,4);
	set_name(30004,"Gassy Blob");
	alter_stat(30004,89,3);
	change_max_health(30004,20);
	place_particle_num(30004,1039,12,4);
	place_particle_num(30004,1039,13,4);
	set_attack_range(30004,3);
	set_name(30005,"Gassy Blob");
	alter_stat(30005,89,3);
	change_max_health(30005,20);
	place_particle_num(30005,1039,12,4);
	place_particle_num(30005,1039,13,4);

	if (gf(20,5) > 0) {
		erase_char(2035);
		erase_char(2036);
		erase_char(30006);
		}
		
	set_name(30009,"Mindless Warrior");
	set_coloradj(30009,2);
	
	if (gf(20,13) == 0)
		sf(20,6,0);
	
	if (gf(30,29) <= 3)
		sf(20,8,0);

	set_name(2049,"Druid Adhuil");
	if (gf(20,14) > 0)
		erase_char(2049);
		else sf(20,15,0);
				
//	set_attack_range(,);

//	add_ability(short which_char_or_group,short which_slot,short which_ability,0);

//	if (is_town_clear(ME))
//		clean_up_town();

	if (gf(20,11) == 0) {
		erase_char(30002);
		spawn_creature(2043);
		sf(20,13,0);
		}
		else {
			sf(20,13,1);
			erase_char(30009);
			erase_char(2043);
			}
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((set_ter1 == 0) && (gf(20,11) > 0)) {
		set_ter1 = 1;
		set_terrain(0,44,22,0);
		set_terrain(0,44,23,0);

		set_terrain(0,35,24,0);
		set_terrain(0,35,25,0);

		set_terrain(0,48,26,0);
		set_terrain(0,49,26,0);

		set_terrain(0,45,39,0);
		set_terrain(0,46,39,0);
		}
		
	if (gf(20,11) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2000,"We're being poisoned.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2000,"Sorry for the smell.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2000,"We are not welcomed.");
		}
	if (gf(20,11) > 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2000,"You helped us.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2000,"Now we have hope.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2000,"Ah! Fresh air!");
		}
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2000,"This is an honor.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(2000,"You are welcome.");

	//if (gf(,) < 2) {
	//	inc_flag(,,1);
	//	if (gf(,) == 2)
	//		begin_talk_mode();
	//	}

	if ((gf(20,15) > 0) && (gf(20,14) == 0)) {
		if (num_chars_in_group(17) == 0) {
			if (char_ok(2049)) {
				sf(20,14,1);
				}
				else sf(20,14,2);
				
			talk_no_exit(100);
			}
		}
		
	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_town()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
		last_abil = get_current_tick();
		
		if ((on_which_layer() == 1) && (char_loc_y(random_group_member(0)) >= 23) && (gf(20,13) == 0)) {
			counter = counter + 1;
			if (counter == 12 - difficulty()) {
				counter = 0;
				set_terrain_string("The poisonous vapors start to overcome you.");
				set_char_status(30000,6,2 + difficulty());
				if (gf(20,12) == 0) {
					sf(20,12,1);
					begin_talk_mode(14);
					}		
				}
			}
		}
break;

beginstate 10;
break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

//	print_str("");
//	set_terrain_string_range(".",1);
//	set_terrain_string_range("The sign says - .",1);
